const url_prefix = "http://localhost:8888"

export interface AnyObject extends Record<string, string | AnyObject> { }
type IAnyProps = string | AnyObject;


function add_url_prefix(config: IAnyProps) {
    if (typeof (config) == 'string') return url_prefix + config;
    Object.keys(config).forEach(key => {
        config[key] = add_url_prefix(config[key])
    })
    return config
}

export default (() => {
    const api = {
        product: {
            getProductList: '/product/getProductList'
        },
        store:{
            getStoreInfo: '/store/getStore'
        },
        user:{
            login: '/person/login',
            getOrder: '/person/getOrder',
            updateOrder: "/person/updateOrder"
        }
    }
    type IApi = typeof api;
    return add_url_prefix(api) as IApi
})()